package com.example.springboot.mapper;

import com.example.springboot.pojo.Infos;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface InfosMapper {

    @Select("select * from user,infos where user.id = infos.userid")
    @Results({
            @Result(property = "user", column = "userid",
                    one = @One(select = "com.example.springboot.mapper.UserMapper.findUserById"))
    })
    List<Infos> findAll();


    @Insert("insert into  infos (pllr,userid) values(#{pllr},#{userid})")
    int insertInfos(Infos infos);

    @Select("select count(*) from infos")
    int countInfos();
}
